import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 学生信息
 */
@Entity('student_student')
export class StudentStudentEntity extends BaseEntity {
  @Column({ comment: '姓名' })
  name: string;

  @Column({ comment: '性别', dict: ['男', '女', '未知'], default: 0 })
  gender: number;

  @Column({ comment: '生日', type: 'date' })
  birthday: Date;

  @Column({ comment: '联系电话', length: 20, default: '' })
  phone: string;

  @Column({ comment: '微信昵称', length: 20, default: '' })
  wechatNickName: string;

  @Column({ comment: '会员卡号', length: 50, default: '' })
  studentNo: string;

  @Column({
    comment: '总度数',
    type: 'decimal',
    precision: 5,
    scale: 2,
    nullable: true,
  })
  totalEye: number;

  @Column({
    comment: '左眼度数',
    type: 'decimal',
    precision: 5,
    scale: 2,
    nullable: true,
  })
  leftEye: number;

  @Column({
    comment: '右眼度数',
    type: 'decimal',
    precision: 5,
    scale: 2,
    nullable: true,
  })
  rightEye: number;

  @Column({ comment: '视光项目', type: 'json', nullable: true })
  optometryProject: number[];

  @Column({ comment: '当前计划ID', nullable: true })
  currentPlanId: number;

  @Column({ comment: '视训次数', default: 0 })
  trainCount: number;

  @Column({ comment: '赠送次数', default: 0, nullable: true })
  giftCount: number;

  @Column({ comment: '购买次数', default: 0 })
  buyCount: number;

  @Column({ comment: '剩余次数', default: 0 })
  remainCount: number;

  @Column({ comment: '积分', default: 0 })
  integral: number;

  @Column({ comment: '来源', default: 0 })
  source: number;

  @Column({ comment: '所属门店', default: 0 })
  shop: number;

  @Column({ comment: '用户类型', default: 0 })
  userType: number;

  @Column({ comment: '入组', default: 139 })
  inGroup: number;

  @Column({ comment: '销售', default: 0 })
  sales: number;

  @Column({ comment: '跟进状态', default: 134 })
  flowStatus: number;

  @Column({ comment: '项目', default: 0 })
  project: number;

  @Column({ comment: '分层', default: 0 })
  layer: number;

  @Column({ comment: '依从性', default: 0 })
  compliance: number;

  @Column({ comment: '最近预约ID', default: 0 })
  lastAppointmentId: number;

  @Column({ comment: '最近就诊ID', default: 0 })
  lastVisitAppointmentId: number;

  @Column({ comment: '就诊次数', default: 0 })
  visitCount: number;

  @Column({ comment: '最近就诊日期', default: null })
  lastVisitDate: Date;

  @Column({ comment: '备注', default: '' })
  remark: string;

  @Column({ comment: '推荐方案', default: '' })
  suggestPlan: string;

  @Column({ comment: 'openid', default: '' })
  openid: string;

  @Column({ comment: 'subway', default: '' })
  subway: string;

  @Column({
    comment: '账户余额',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0,
  })
  balance: number;

  @Column({ comment: '创建用户ID', nullable: true })
  createUserId: number;
}
